const http = require('http');
const httpProxy = require('http-proxy');

// var httpProxy = require('http-proxy');
// var proxy = httpProxy.createServer({ target:'http://localhost:3000', auth: 'admin:123456' });
// proxy.listen(9999);


const proxy = httpProxy.createProxyServer({
  auth: 'admin:123456'
});
http.createServer(function(req, res) {
  console.log('Request', req.method, req.url);
  proxy.web(req, res, { target:'http://localhost:3000' });
}).listen(9999);